package com.w.tank;

import java.util.LinkedList;
import java.util.List;

public class ColliderChain implements Collider{
    private List<Collider> colliders = new LinkedList<>();
    public ColliderChain(){
        colliders.add(new TankTankColl());
        colliders.add(new TankBullectColl());
        colliders.add(new TankWarColl());
        colliders.add(new BullectWallColl());
    }

    public void add(Collider c){
        colliders.add(c);

    }

    @Override
    public boolean collide(GameObject g1, GameObject g2) {
        for(int i=0;i<colliders.size();i++){
            if(colliders.get(i).collide(g1, g2)) return false;
        }
        return true;
    }
}
